{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline">
                            <input type="text"  name="start" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="申请开始时间"/>
                        </div>

                        <div class="layui-input-inline">
                            <input type="text"  name="end" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="申请结束时间"/>
                        </div>
                        <div class="layui-input-inline">
                            <select name="withdraw_status" lay-search="">
                                <option  value="">不限</option>
                                <option  value="1">待审核</option>
                                <option  value="2">通过</option>
                                <option  value="3">未通过</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="keyword" class="layui-input search" name="keyword" value="" placeholder="昵称|手机号码"/>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>

                <div class="col-sm-12">
                    <div class="input-group" >
                        <!--<button class="btn btn-primary" type="button" onclick="wk.href('{:url('add')}');">-->
                        <!--<i class="fa fa-plus"></i> 添加-->
                        <!--</button>-->
                        <!--<button class="btn btn-primary" type="button" onclick="wk.href('{:url('unbookAdd')}');" style="margin-left: 5px">-->
                        <!--<i class="fa fa-plus"></i> 添加非图书-->
                        <!--</button>-->

                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                        <!--<i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                        <!--&lt;!&ndash;<li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>&ndash;&gt;-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="usingAllS"><i class="fa fa-check-circle"></i> 批量上架</a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchForbiddenS"><i class="fa fa-ban"></i> 批量下架</a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 批量导出</a></li>-->
                        <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>-->
                        <!--</ul>-->
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                <!--<div class="input-group" >-->
                <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                <!--<i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>-->
                <!--</button>-->
                <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                <!--<li><a href="javascript:;" class="layuiBtn" data-type="excelIn"><i class="fa fa-check-circle"></i> 批量导入 </a></li>-->
                <!--<li><a  href="javascript:;" class="layuiBtn" data-type="usingAllS"><i class="fa fa-ban"></i> 批量上架</a></li>-->
                <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchForbiddenS"><i class="fa fa-trash-o"></i> 批量下架</a></li>-->
                <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchDel"><i class="fa fa-trash-o"></i> 批量删除</a></li>-->
                <!--&lt;!&ndash;<li><a  href="javascript:;" class="layuiBtn" data-type="excelIn"><i class="fa fa-external-link"></i> 批量导入</a></li>&ndash;&gt;-->
                <!--</ul>-->
                <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">
                            <i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">
                            <li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 批量导出</a></li>
                            <li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>
                            <li><a  href="javascript:;" class="layuiBtn" data-type="refuse"><i class="fa fa-external-link"></i> 批量拒绝</a></li>
                            <li><a  href="javascript:;" class="layuiBtn" data-type="adopt"><i class="fa fa-external-link"></i> 批量通过</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--修改状态模板-->
                    <!--<script type="text/html" id="staBar">-->
                    <!--<input type="checkbox" value="{{d.school_id}}"  lay-skin="switch"  lay-text="上架中|已下架" lay-filter="OnOff" {{ d.school_status == 1 ? 'checked' : '' }} >-->
                    <!--</script>-->

                    <!--状态显示模板-->
                    <!--<script type="text/html" id="imgTpl">-->
                    <!--<img src="{{d.rb_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />-->
                    <!--</script>-->
                    <!--操作模板-->
                    <script type="text/html" id="withdraw_status">
                        {{# if(d.withdraw_status == 1){ }}
                        <span style="color:#1ab394">待审核</span>
                        {{# } }}
                        {{# if(d.withdraw_status == 2){ }}
                        <span style="color:#ec4758">通过</span>
                        {{# } }}
                        {{# if(d.withdraw_status == 3){ }}
                        <span style="color:#ec4758">未通过</span>
                        {{# } }}
                        {{# if(d.withdraw_status == 4){ }}
                        <span style="color:#ec4758">已领取</span>
                        {{# } }}
                    </script>
                    <script type="text/html" id="withdraw_type">
                        {{# if(d.withdraw_type == 1){ }}
                        <span style="color:#1ab394">微信</span>
                        {{# } }}
                        {{# if(d.withdraw_type == 2){ }}
                        <span style="color:#ec4758">支付宝</span>
                        {{# } }}
                    </script>
                    <script type="text/html" id="opeBar">
                        {{# if(d.withdraw_status == 1){ }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.withdraw_id}}','{:url('adopt')}','确定审核通过?')"  class="btn btn-primary btn-xs m-r-xs" title="通过"><i class="fa fa-pencil">通过</i></a>
                        <!--<a href="javascript:;" onclick="wk.confirm('{{d.withdraw_id}}','{:url('refuse')}','确定拒绝吗?')"  class="btn btn-danger btn-xs m-r-xs" title="拒绝"><i class="fa fa-adjust">拒绝</i></a>-->
                        <a href="javascript:;" onclick="wk.href('{:url('refuse')}?withdraw_id={{d.withdraw_id}}')" class="btn btn-danger btn-xs m-r-xs" title="拒绝"><i class="fa fa-adjust">拒绝</i></a>
                        {{# } }}

                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>

{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("withdraw/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                ,{type:'numbers', width: 80, title: '序号'}
                , {field: 'user_id', width: 80, title: 'ID', align: 'center'}
                , {field: 'withdraw_num', width: 200, title: '提现单号', align: 'center'}
                , {field: 'user_username', width: 150, title: '昵称', align: 'center'}
                , {field: 'user_phone', width: 150, title: '手机号', align: 'center'}
                , {field: 'withdraw_status', width: 120, title: '审核状态', align: 'center',toolbar: '#withdraw_status'}
                , {field: 'withdraw_create_time', width: 200, title: '申请时间', align: 'center'}
                , {field: 'withdraw_money', width: 200, title: '提现金额', align: 'center'}
                , {field: 'withdraw_type', width: 200, title: '提现方式', align: 'center',toolbar: '#withdraw_type'}
                , {fixed: 'right', width:200, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('#allidsForOut').val(res.count2);
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        var $ = layui.$, active = {
            //批量拒绝
            refuse:function () {
                wk.refuse(getIds(),$('.layui-input').serialize(),"{:url('refuse1')}");
            },
            //批量拒绝
            adopt:function () {
                wk.adopt(getIds(),$('.layui-input').serialize(),"{:url('adopt')}");
            },
            //批量导出订单
            excelAll:function () {
                wk.excelAll(getIds(),$('.layui-input').serialize(),"{:url('outExcel')}");
            },
            //全部导出
            excelAllNoSelect:function () {
                wk.excelAll($('#allidsForOut').val(),$('.layui-input').serialize(),"{:url('outExcel')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['withdraw_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>